
/* Generated by Interface Builder */

#import "Shifter.h"
#import <appkit/appkit.h>

@implementation Shifter

#define COUNTER  0
#define SQUARER 1

- appDidInit:sender
{  //When app inits, install wide view array into the output array.
    id	aView;
    aView=[[View alloc] init];  //create a new contentView
    arrayView=[ViewArray setContentView:aView];  //swap,get array of views
    [ViewArray free];  //we have the view, no longer need this
    [outputView addSubview:arrayView]; //add to outputView
    [arrayView moveTo: 0.0 :0.0]; //start with leftmost (counter) view
    [outputView display];
    nextPanel=SQUARER;
    return self;
}

- changeView:sender
{
    switch (nextPanel) {
    	case SQUARER:       //change to squarer
		[arrayView moveTo:-200.0 :0.0]; //move view to squarer
  		[outputView display];
		nextPanel=COUNTER;
		[[sender selectedCell] setTitle:"Counter"];
		break;
		
	case COUNTER:  //change to counter
		[arrayView moveTo:0.0 :0.0]; //move view to counter 
  		[outputView display];
		nextPanel=SQUARER;
		[[sender selectedCell] setTitle:"Squarer"];
		break;
	}
			
    return self;
}

- count:sender
{
    [countDisplay setIntValue:([countDisplay intValue]+1)];
    return self;
}

- square:sender
{
    float value=[sender floatValue];
    [squareRoot setFloatValue:value];
    [square setFloatValue:(value*value)];
    return self;
}


@end
